/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ReminderPage.java
 *
 * Created on 07 14, 12, 3:46:45 PM
 */
package malateproject;

import javax.swing.JOptionPane;

/**
 *
 * @author Aeron
 */
public class ReminderPage extends javax.swing.JFrame {

    /** Creates new form ReminderPage */
    public ReminderPage() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jListReminder = new javax.swing.JList();
        jButtonRemoveRemin = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(40, 80, 260, 160);

        jButton1.setText("Send Reminder");
        getContentPane().add(jButton1);
        jButton1.setBounds(150, 250, 140, 30);
        getContentPane().add(jTextField1);
        jTextField1.setBounds(70, 30, 230, 30);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("To:");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(40, 40, 34, 14);

        jListReminder.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(jListReminder);

        getContentPane().add(jScrollPane2);
        jScrollPane2.setBounds(370, 70, 170, 170);

        jButtonRemoveRemin.setText("Remove Reminder");
        jButtonRemoveRemin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRemoveReminActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonRemoveRemin);
        jButtonRemoveRemin.setBounds(390, 250, 130, 30);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Reminders");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(420, 40, 80, 17);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/MalateBG.E-res.jpg"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 560, 300);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButtonRemoveReminActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveReminActionPerformed
// TODO add your handling code here:
    
    if(jListReminder.getSelectedValue().equals(null))
    {
        JOptionPane.showMessageDialog(null,"No current selection");
    }
    else
    {
         int reply = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete?", "Delete Reminder", JOptionPane.YES_NO_OPTION);
    if (reply == JOptionPane.YES_OPTION)
    {
        int index = jListReminder.getSelectedIndex();
        jListReminder.remove(index);
    }
    }
}//GEN-LAST:event_jButtonRemoveReminActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ReminderPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ReminderPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ReminderPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ReminderPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ReminderPage().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonRemoveRemin;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JList jListReminder;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}
